package com.kzc.controller;

import com.kzc.base.model.Result;
import com.kzc.entity.Article;
import com.kzc.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Author：柯尊诚
 * Created by anyleKe on 2016/2/25.
 */
@Controller
@RequestMapping("/collection")
public class CollectionController {

    @Autowired
    CollectionService collectionService;

    @ResponseBody
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public Result add(@ModelAttribute Article article) {
        System.out.print(article.toString());
        return collectionService.add(article);
    }

    @ResponseBody
    @RequestMapping(value = "/query", method = RequestMethod.GET)
    public Result query(@RequestParam String qtoken) {
        return collectionService.queryCollection(qtoken);
    }

    @ResponseBody
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public Result delete(@RequestParam String sysId, @RequestParam String qtoken) {
        System.out.print(sysId + "============" + qtoken);
        return collectionService.delete(sysId, qtoken);
    }



}
